<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<load href="__PUBLIC__/css/bootstrap.min.css" />
<load href="__PUBLIC__/css/main.css" />
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<load href="__PUBLIC__/js/main.js" />
<script type="text/javascript">
$(function(){
	var template = "{$result.template}";
	$("select[name='template'] option").each(function(index, element) {
		if($(this).val() == template){
			$(this).attr("selected","selected");
			$(".thumbpreview:eq("+(index)+")").show().siblings().hide();
		}
	});
	function select_plate(){
		$("input.select_plate").each(function(index, element){
			var select_plate = $(this);
			var val = select_plate.val();
			if(select_plate.is(':checked')){
				$("#tpl_iframe").contents().find(".p_"+val).show();
			}
		})
	}
	function isbodyshow(){
		<if condition="$result.state eq 0">
			$("#tpl_iframe").contents().find(".body_close").show();
			$("#tpl_iframe").contents().find(".body").hide();
			<else/>
			$("#tpl_iframe").contents().find(".body_close").hide();
			$("#tpl_iframe").contents().find(".body").show();
		</if>
	}
	function isshowvshow(){
		<if condition="$result.showv eq 0">
			$("#tpl_iframe").contents().find(".showv").hide();
			<else/>
			$("#tpl_iframe").contents().find(".showv").show();
		</if>
	}

	function ep_fwei_tar(){
		var ep_fwei_value = $("input[name='ep_fwei']:checked").val();
		if(ep_fwei_value==1){
			$("#fweishow").show();
		}else{
			$("#fweishow").hide();
		}	
	}
	$("input[name='ep_fwei']").each(function(index, element) {
        $(this).click(function(){
			if($(this).val()==1){
				$("#fweishow").show();
			}else{
				$("#fweishow").hide();
			}
		})
    });
	window.onload = function(){
　　		ep_fwei_tar();
		select_plate();
		isbodyshow();
		isshowvshow();
	}
})
</script>
</head>

<body>
<!-- 图片资源开始 -->
<div class="floatBackground" id="floatBackground" style="display: none;">
	<div class="bounced">
	<label class="closeImgResurces">X</label>
	<iframe id="imgResourcesiframe" src="{:rtrim(U('Upload/index'),'.html')}" width="750" height="465" frameborder="0" scrolling="auto"></iframe>
	</div>
</div>
<!-- 图片资源结束 -->
<!-- 模板页 -->
<div class="tpl_illustrate"><span>模板样式</span><iframe id="tpl_iframe" class="tpl_iframe" frameborder="0" scrolling="yes" src=""></iframe></div>
<assign name="tplrbac" value="$Think.session.userinfo.tplrbac"/>
<div class="main-frame">
	<div class="position">华人码 > 编辑华人码</div>
	<div class="addobject">
		<div class="obj-form">
			<form name="form1" id="typeform1" action="{:U('Type/typeedit',array('id'=>$result['id']))}" method="post" class="form-inline">
				<ul>
					<li>
						<label class="fl tle">码台标题：</label>
						<span class="fl cnt"><input name="typename" class="form-control" placeholder="标题" value="{$result.typename}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">模板选择：</label>
				    	<span class="fl cnt">
					    	<select name="template" disabled class="template form-control" style="width: 300px; padding: 0px 6px;">
								<volist name="tpl" id="v">
									<in name="v['key']" value="$tplrbac">
										<option <if condition="$v['idx'] eq $result['template']">selected="selected"</if> value="{$v['idx']}">{$v['name']}{$v['des']}</option>
									</in>
								</volist>
							</select>
							<em>*</em>
				    	</span>
					</li>
					<!--<li>
						<label class="fl tle">domainID：</label>
						<span class="fl cnt"><input name="domainid" class="form-control" placeholder="domainid" value="{$result.domainid}"><em>* <font>关联旧版的domainID</font></em></span>
					</li>-->
					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px; width: 600px;">选择模块（勾选模块可在右侧预览效果）</label></li>
					<li>
						<label class="fl tle">模块名称：</label>
						<span class="fl cnt">
							<ul class="platecss">
							<volist name="plate" id="tl">
								<li><input class="select_plate" type="checkbox" value="{$tl['id']}" name="plate_id[]" <in name="tl['id']" value="$result.plate_id">checked="checked"</in> style="width: auto;" /> {$tl['plate_name']}</li>
							</volist>
							</ul>
						</span>
					</li>

					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">其他参数</label></li>
					<li>
						<label class="fl tle">状态显示：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="state" value="1" <if condition="$result.state eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="state" value="0" <if condition="$result.state eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<li style="display: none;">
						<label class="fl tle">导航显示：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="isbottom" value="1" <if condition="$result.isbottom eq 1">checked="checked"</if>> 下
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="isbottom" value="0" <if condition="$result.isbottom eq 0">checked="checked"</if>> 上
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="isbottom" value="2" <if condition="$result.isbottom eq 2">checked="checked"</if>> 都不显示
						</span>
					</li>
					<li>
						<label class="fl tle">显示访问量：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="showv" value="1" <if condition="$result.showv eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="showv" value="0" <if condition="$result.showv eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<li>
						<label class="fl tle">查询次数：</label>
						<span class="fl cnt"><input name="num" class="txtlength200" placeholder="查询次数" value="{$result.num}" style="width:100px;"></span>
					</li>
					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">防伪信息</label></li>
					<li>
						<label class="fl tle">是否加防伪：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="ep_fwei" value="1" <if condition="$result.ep_fwei eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="ep_fwei" value="0" <if condition="$result.ep_fwei eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<div id="fweishow" style="display:none;">
					<li>
						<label class="fl tle">生产厂商：</label>
						<span class="fl cnt"><input name="ep_sc" class="txtlength200" placeholder="生产厂商" value="{$result.ep_sc}"></span>
					</li>
					<li>
						<label class="fl tle">企业地址：</label>
						<span class="fl cnt"><input name="ep_addres" class="txtlength200" placeholder="企业地址" value="{$result.ep_addres}"></span>
					</li>
					<li>
						<label class="fl tle">服务热线：</label>
						<span class="fl cnt"><input name="ep_phone" class="txtlength200" placeholder="服务热线" value="{$result.ep_phone}"></span>
					</li>
					<li>
						<label class="fl tle">邮编：</label>
						<span class="fl cnt"><input name="ep_code" class="txtlength200" placeholder="邮编" value="{$result.ep_code}"></span>
					</li>
					</div>
					<!--针对一物一码的活动时间-->
					<if condition="$isyard eq 1">
					<link rel="stylesheet" type="text/css" href="/assets/live/css/jquery.datetimepicker.css"/>
					<li>
						<label class="fl tle">开始时间：</label>
						<span class="fl cnt"><input id="yard_startdate" name="yard_startdate" class="txtlength200" placeholder="开始时间" value="{$result.yard_startdate}"></span>
					</li>
					<li>
						<label class="fl tle">结束时间：</label>
						<span class="fl cnt"><input id="yard_enddate" name="yard_enddate" class="txtlength200" placeholder="结束时间" value="{$result.yard_enddate}"></span>
					</li>
						<script src="/assets/live/js/jquery.datetimepicker.full.js"></script>
						<script type="text/javascript">
							function getNowFormatDate() {
								var date = new Date();
								var seperator1 = "-";
								var seperator2 = ":";
								var month = date.getMonth() + 1;
								var strDate = date.getDate();
								if (month >= 1 && month <= 9) {
									month = "0" + month;
								}
								if (strDate >= 0 && strDate <= 9) {
									strDate = "0" + strDate;
								}
								var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
										+ " " + date.getHours() + seperator2 + date.getMinutes();
								return currentdate;
							}
							$.datetimepicker.setLocale('zh');
							$('#yard_startdate').datetimepicker({value:<if condition="$result['yard_startdate'] neq ''">'{$result.yard_startdate}'<else />getNowFormatDate()</if>,step:10});
							$('#yard_enddate').datetimepicker({value:<if condition="$result['yard_enddate'] neq ''">'{$result.yard_enddate}'<else />getNowFormatDate()</if>,step:10});
						</script>
					</if>
					<li class="submit">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><input type="submit" value="确定修改" class="submitbtn" /> <a onclick="javascript:history.go(-1);" style="cursor:pointer;">取消</a></span>
					</li>
				</ul>
			</form>
		</div>
		<div class="obj-previewimg">
			<div class="instructions">
				<div class="rotation">
					<volist name="tpl" id="v" key="i">
						<in name="v['key']" value="$tplrbac">
							<div class="thumbpreview"><img src="__IMG__/test{$v['key']}.jpg" /></div>
						</in>
					</volist>
				</div>
				<b>操作说明：</b><br>
				1、带有红色  “ * ” 项必填<br>
				2、domainID(关联旧版的domainID)<br>
				3、企业名称是为了看清楚此码是为哪个企业服务<br>
				4、保存之后将返回列表页面，以方便其他操作
			</div>
		</div>
	</div>

</div>
</body>
</html>
